<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>编辑课程类型</title>
    <link rel="stylesheet"th:href="@{/static/lib/bootstrap/bootstrap.min.css}">
    <script th:src="@{/static/lib/jquery/1.9.1/jquery.js}"></script>
    <script th:src="@{/static/lib/jquery.validation/1.14.0/jquery.validate.js}"></script>
    <script th:src="@{/static/lib/jquery.validation/1.14.0/messages_zh.js}"></script>
    <script th:src="@{/static/lib/vue.min.js}"></script>
    <script type="text/javascript" th:src="@{/static/lib/layer/2.4/layer.js}"></script>
</head>
<body>
<br/>
<br/>
<br/>
<div class="container">

    <form id="editUserForm">
        <div class="form-group" >
            <label for="typeName">课程类型：</label>
            <input type="text" class="form-control" id="typeName"  th:value="${name}"  >
        </div>
        <div class="form-group">
            <button type="button" id="saveBtn" class="btn btn-success">确定</button>
            <button type="button" id="cancelBtn" class="btn btn-default">取消</button>
        </div>
    </form>
</div>
</body>
<script type="text/javascript">

    var xiugai=function () {
        $.ajax({
            url:'/type/upType',
            type:'POST',
            dataType:'JSON',
            data:({
                typeName:$("#typeName").val(),
                typeId:[[${typeid}]]
            }),
            success:function (result) {
                if(result=="0"){
                    layer.msg('修改失败,请重新修改')
                }else {
                    window.location.href='/admin/toType' ;
                }
            }
        })
    }

    $("#saveBtn").click(function () {
      xiugai()
    });
    $("#cancelBtn").click(function () {
       window.history.go(-1)
    })
</script>


</html>
